/*
 * @Author: your name
 * @Date: 2020-01-03 14:12:57
 * @LastEditTime: 2020-10-27 15:39:59
 * @LastEditors: wjk
 * @Description: In User Settings Edit
 * @FilePath: \bixuan_uni\src\apis\home.js
 */
import request, { requestNew } from '@/utils/request'
export async function getHome(params) {
  const res = await request({
    url: '/home',
    method: 'post',
    data: params || {}
  })
  return res
}

export async function getSearchKey(params) {
  const res = await request({
    url: '/home/search-key',
    method: 'post',
    data: params || {}
  })
  return res
}

export async function goodsSearch(params) {
  const res = await requestNew({
    url: '/search',
    method: 'get',
    params: params || {}
  })
  return res
}

export async function searchSuggest(params) {
  const res = await requestNew({
    url: '/search/suggest',
    method: 'get',
    params: params || {},
    headers: {
      showLoading: false
    }
  })
  return res
}

export async function goodsTimeLine(params) {
  const res = await request({
    url: '/goods/timeline',
    method: 'post',
    data: params || {}
  })
  return res
}

export async function getCategory(params) {
  const res = await request({
    url: '/goods/category/2',
    method: 'post',
    data: params || {}
  })
  return res
}

export async function getCategorySub(params) {
  const res = await request({
    url: '/goods/category/3',
    method: 'post',
    data: params || {}
  })
  return res
}

export async function getSubjectDetail(params) {
  const res = await request({
    url: '/goods/subject/detail',
    method: 'post',
    data: params || {}
  })
  return res
}

export async function getSubjectTag(params) {
  const res = await request({
    url: '/goods/subject/tag',
    method: 'post',
    data: params || {}
  })
  return res
}

export async function getChoiceness(params) {
  const res = await request({
    url: '/goods/choiceness',
    method: 'post',
    data: params || {}
  })
  return res
}

export async function getActivity(params) {
  const res = await request({
    url: '/goods/activity',
    method: 'post',
    data: params || {}
  })
  return res
}
/**
 * @Author: wjk
 * @Date: 2020-04-21 13:32:22
 * @LastEditors: wjk
 * @description: 5.0 获取首页信息接口
 * @return: 首页返回值
 */
export async function getHomeDetail(params) {
  const res = await requestNew({
    url: '/manage-home/v5/home/detail-v2',
    method: 'get',
    params: params || {}
  })
  return res
}
/**
 * @Author: wzm
 * @Date: 2020-10-26 09:32:22
 * @LastEditors: wzm
 * @description: 5.0 获取首页信息接口
 * @return: 首页返回值
 */
export async function getHomeRecommendGoods(params) {
  const res = await requestNew({
    url: `/manage-home/cateRecommend/list/${params.id}`,
    method: 'get',
    params,
    headers: {
      showLoading: true,
      showMessage: false
    }
  })
  return res
}
/**
 * @Author: wjk
 * @Date: 2020-04-21 13:32:22
 * @LastEditors: wjk
 * @description: 5.0 首页品牌信息
 * @return: 首页品牌信息
 */
export async function getHomeBrand(params) {
  const res = await requestNew({
    url: '/manage-home/v5/home/brand',
    method: 'get',
    data: params || {}
  })
  return res
}

// 首页分享滚动列表
export async function getHomeShareList(params) {
  const res = await request({
    url: '/bestSeller/listShareShow',
    method: 'get',
    params: params || {}
  })
  return res
}

/**
 * @description: 今日热卖
 * @return: 今日热卖
 */
export async function getHotBuy(params) {
  const res = await request({
    url: '/bestSeller/listBestSeller',
    method: 'get',
    params
  })
  return res
}

/**
 * @description: 添加分享统计记录
 */
export async function addHotBuyShare(data) {
  const res = await request({
    url: '/bestSeller/addStatisticRecord',
    method: 'post',
    data: data || {}
  })
  return res
}

// goods 优惠券
export async function getGoodsRemind() {
  const res = await requestNew({
    url: '/bihs/activity/full-give/message/list',
    method: 'get',
    headers: {
      showLoading: false
    }
  })
  return res
}

// 风云人物排行榜
export async function saleTopRankingList(data) {
  const res = await request({
    url: '/saleTopRanking/list',
    method: 'post',
    data: data || {},
    headers: {
      showLoading: false
    }
  })
  return res
}

// 风云人物详情
export async function saleTopRankingDetail(data) {
  const res = await request({
    url: '/saleTopRanking/detail',
    method: 'post',
    data: data || {},
    headers: {
      showLoading: false
    }
  })
  return res
}
